﻿//-----------------------------------------------------------------------
// <copyright file="WorkerValidator.cs" company="FER">
//     Copyright (c) All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace NMBP.View.Validators
{
    using NMBP.Models;

    /// <summary>
    /// Represents validator for worker object
    /// </summary>
    public static class WorkerValidator
    {
        /// <summary>
        /// validates worker object
        /// </summary>
        /// <param name="worker">customer to be validated</param>
        public static bool ValidateWorker(Worker worker)
        {

            if (!worker.Contact.Contains("@") || worker.Contact.Length > 20)
            {
                return false;
            }

            if (worker.Name.Length < 5 || worker.Name.Length > 20)
            {
                return false;
            }

            if (worker.Surname.Length < 5 || worker.Surname.Length > 20)
            {
                return false;
            }

            if (worker.Password.Length < 5 || worker.Password.Length > 20)
            {
                return false;
            }

            if (worker.Username.Length < 5 || worker.Username.Length > 20)
            {
                return false;
            }

            if (worker.VpnNumber.Length != 3)
            {
                return false;
            }

            if (worker.Sallary <= 0 || worker.Sallary > 15000)
            {
                return false;
            }

            if (worker.Department == null)
            {
                return false;
            }

            return true;
        }
    }
}
